<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>layui</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="../../lib/layui-v2.6.3/css/layui.css" media="all">
	<link rel="stylesheet" href="../../css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
	<div class="layuimini-main">

		<form class="layui-form layui-form-pane" action="" lay-filter="updateSubForm">
			<div class="layui-form-item">
				<label class="layui-form-label">系数K</label>
				<div class="layui-input-block">
					<input type="hidden" name="no">
					<input type="hidden" name="childId">
					<input type="text" name="k" class="layui-input">
				</div>
			</div>

			<!--<div class="layui-form-item">
				<div class="layui-inline">
					<label class="layui-form-label">前置传感器</label>
					<div class="layui-input-inline">
						<input type="text" name="pre" autocomplete="off"
						       class="layui-input">
					</div>
				</div>
				<div class="layui-inline">
					<label class="layui-form-label">后置传感器</label>
					<div class="layui-input-inline">
						<input type="text" name="next" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-inline">
					<label class="layui-form-label">与前置距离</label>
					<div class="layui-input-inline">
						<input type="text" name="l" autocomplete="off" class="layui-input">
					</div>
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">管路半径</label>
				<div class="layui-input-block">
					<input type="text" name="r" lay-verify="required" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item" pane="">
				<label class="layui-form-label">位置状态</label>
				<div class="layui-input-block">
					<input type="radio" name="type" value="4" title="管路首个传感器">
					<input type="radio" name="type" value="0" title="支路首个传感器">
					<input type="radio" name="type" value="1" title="普通传感器">
					<input type="radio" name="type" value="2" title="变径转角处">
				</div>
			</div>-->

			<div class="layui-form-item">
				<button class="layui-btn" lay-submit="" lay-filter="saveBtn">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</form>
	</div>
</div>
<script src="../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            $.post('/sensor/update', data.field, function (res) {
                if (res.code === 0) {
					layer.msg('更新成功', {icon: 1});
                    var iframeIndex = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(iframeIndex);
                    parent.layui.table.reload(data.field.childId)
                }else {
					layer.msg('更新失败,稍后重试', {icon: 2});
				}
            });
            return false;
        });
    });
</script>
</body>
</html>
